using System;
using System.Collections.Generic;
using System.Text;

namespace PDSClient.Communication
{
    /// <summary>
    /// Represents an abstract network connection with the Project Darkstar Server.
    /// </summary>
    public interface IClientConnection
    {
        /// <summary>
        /// Asynchronously sends data to the server.
        /// <p>The specified byte array must not be modified after invoking this 
        /// method; if the byte array is modified, then this method may have
        /// unpredictable results.</p>
        /// </summary>
        /// <param name="message">the message data to send</param>
        /// <exception cref="IOException">if there was a synchronous problem sending the message</exception>
        void SendMessage(byte[] message);

        /// <summary>
        /// Asynchronously closes the connection, freeing any resources in use.
        /// The connection should not be considered closed until
        /// ClientConnectionListener.Disconnected() is invoked.
        /// </summary>
        /// <exception cref="IOException">if there was a synchronous problem closing the connection</exception>
        void Disconnect();
    }
}
